
<script src="/static/admin/js/jquery.js"></script>
<script src="/static/admin/js/home-slide.js"></script>
<script src="/static/lib/layer/layer.js"></script>

<script>
    <!--记录登录日志ajax是否请求过-->
var flag = false;

$(function () {
    $("#modify-btn").click(function(e){
        e.preventDefault();
        $.ajax({
            url:"passwordmodify",
            type:'post',
            data:$('#modify-form').serialize(),
            dataType:'json',
            success: function (data) {
                if (data.code == 1){
                    layer.msg(data.msg,{
                        time:2000,
                        icon:6
                    },function () {
                        location.href=data.url;
                    });
                } else{
                    layer.open({
                        title:'修改密码失败',
                        content:data.msg,
                        icon: 5,
                        anim: 6
                    });
                }
            }
        });
    });
});


$(function () {
    $("#btn-loginout").click(function (e) {
        e.preventDefault();
        $.ajax({
            url: "loginout",
            method: 'post',
            dataType:'json',
            success:function (data) {
                if (data.code ==1){
                    layer.msg(data.msg,{
                        icon: 6,
                        time:2000
                    },function () {
                        location.href = data.url;
                    });
                } else{
                    layer.open({
                        title:'注销失败',
                        content: data.msg,
                        icon:5
                    });
                }
            }
        });
    });
});

$(function () {
    $("#btn-log").click(function () {
        if (!flag){
            $.ajax({
                url:"log",
                type:'get',
                success:function (data) {
                    $("#log-info").prepend(data.html);
                }
            });
            flag = true;
        }
    });
});

</script>